<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8" import="java.util.List"
	import="xyz.xiangyushui.javaBean.sales.SalesDailyRecord"
	import="java.util.List"
	import="xyz.xiangyushui.javaBean.employee.Store"%>
<%@include file="/lib/common/basedir.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
<%@include file="/lib/common/headerResource.html"%>

<!--sidebar-->
<link href="<%=basedir%>/lib/css/sidebar.css" rel="stylesheet">

<!-- picture cover -->
<link rel="stylesheet" type="text/css"
	href="<%=basedir%>/lib/util/pictureCover/css/normalize.css" />
<link rel="stylesheet"
	href="<%=basedir%>/lib/util/pictureCover/css/style.css">

<link
	href="<%=basedir%>/lib/util/bootstrap-select/bootstrap-select.min.css"
	rel="stylesheet">

<title>DessertHouse</title>

<style>
img {
	width: 250px;
}

.rowGap2 {
	margin-bottom: 2.4em;
}

.subtitle {
	margin-top: 0.2em;
}

.formContent {
	margin-top: 3em;
	margin-bottom: 3em;
}

.line {
	margin-right: 1.5em;
}
</style>

</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<!--左侧导航-->
			<div class="col-sm-3 col-md-2 sidebar">
				<%@include file="../sidebar.jsp"%>
			</div>

			<!--右面板-->
			<div
				class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 rightPanel">
				<div class="col-md-10">
					<div class="row">
						<ul class="nav nav-tabs">
							<li role="presentation" class="active"><a
								href="<%=basedir%>/manager/dataAnalysis">每月销售额统计</a></li>
							<li role="presentation"><a
								href="<%=basedir%>/manager/dataAnalysis/fashionDessert">每月热门产品</a></li>
						</ul>
					</div>


					<form class="form-inline formContent" method="post"
						action="<%=basedir%>/manager/salesDaily">
						<div class="form-group line">
							<select id="lunchBegins" name="store" class="selectpicker"
								data-live-search="true" data-live-search-style="begins"
								title="请选择店铺">

								<%
									@SuppressWarnings("unchecked")
									List<Store> stores = (List<Store>) request.getAttribute("stores");
									if (stores != null) {
										for (Store s : stores) {
								%>
								<option><%=s.getStoreId() + "-" + s.getStoreName()%></option>
								<%
									}
									}
								%>
							</select>
						</div>

						<div class="form-group line">
							<select id="lunchBegins" name="month" class="selectpicker"
								data-live-search="true" data-live-search-style="begins"
								title="请选择月份">
								<%
									for (int i = 0; i < 12; i++) {
								%>
								<option><%=i + 1%> 月
								</option>
								<%
									}
								%>
							</select>
						</div>

						<div class="form-group line">
							<button type="submit"
								class="btn btn-default btn-block save col-md-2">查询</button>
						</div>

					</form>

					<% 	@SuppressWarnings("unchecked")
						List<SalesDailyRecord> sales=(List<SalesDailyRecord>)request.getAttribute("dailyTotal");
					%>

					<canvas id="myChart" width="600" height="400"></canvas>
				</div>
			</div>
		</div>
	</div>


	<!-- jquery and bootstrap js -->
	<%@include file="/lib/common/footerResource.html"%>
	<script src="<%=basedir%>/lib/util/pictureCover/js/ns.hover.min.js"></script>
	<script
		src="<%=basedir%>/lib/util/bootstrap-select/bootstrap-select.js"></script>

	<script src="<%=basedir%>/lib/util/chart/Chart.min.js"></script>

	<script>
		var data = {
			labels : [ 
			           <%if(sales!=null){
			           for (SalesDailyRecord s:sales){
			        	   out.print("\""+s.getDate()+"\",");
			           }}%>
			         ],
			datasets : [ {
				fillColor : "rgba(151,187,205,0.5)",
				strokeColor : "rgba(151,187,205,1)",
				pointColor : "rgba(151,187,205,1)",
				pointStrokeColor : "#fff",
				data : [  
						<%if(sales!=null){
				           for (SalesDailyRecord s:sales){
				        	   out.print("\""+s.getTotal()+"\",");
				           }}%> ]
			} ]
		}
		var ctx = $("#myChart").get(0).getContext("2d");
		//This will get the first returned node in the jQuery collection.
		var myNewChart = new Chart(ctx).Line(data);
	</script>
</body>
</html>